package com.example.dllo.my36kr.ui.fragment;

import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.example.dllo.my36kr.R;

import com.example.dllo.my36kr.tools.FindBannerUrls;

import com.example.dllo.my36kr.ui.activity.sonactivity.AcademyActivity;
import com.example.dllo.my36kr.ui.activity.sonactivity.EventActivity;
import com.example.dllo.my36kr.ui.activity.sonactivity.GoodActivity;
import com.example.dllo.my36kr.ui.activity.sonactivity.IAmActivity;
import com.example.dllo.my36kr.ui.activity.sonactivity.PeopleActivity;
import com.example.dllo.my36kr.ui.activity.sonactivity.SearchActivity;
import com.youth.banner.Banner;

import java.util.List;

/**
 *
 * Created by CPC_272 on 16/8/15.
 * 发现界面
 */
public class FindFragment extends AbsBaseFragment implements View.OnClickListener {
    private ImageView find_search;
    private Banner findBanner;
    private FrameLayout framFindPeople;
    private Button Btn_activity, Btn_academy;
    private String[] findBannerUrls = FindBannerUrls.findBannerUrls;
    private LinearLayout lay_iam, lay_good;
    @Override
    protected int setLayout() {
      return R.layout.fragment_find;
    }

    @Override
    protected void initView() {
          findBanner=byView(R.id.banner_head_find);//轮播图
          find_search =byView(R.id.find_search);//搜索
          Btn_academy=byView(R.id.Btn_academy);//36氪研究院
          Btn_activity=byView(R.id.Btn_event);//近期活动
          lay_good=byView(R.id.llay_iam);//我是创业者的整一条的布局
          lay_iam=byView(R.id.llay_good);//我是专业投资人的一横排的布局 取这个id目的为了让这个这块每个位置都可以点 其他位置不好用
          framFindPeople=byView(R.id.fram_iaminvester);//寻找投资人
    }
    @Override
    protected void initData() {
       find_search.setOnClickListener(this);
        Btn_activity.setOnClickListener(this);
        Btn_academy.setOnClickListener(this);
        framFindPeople.setOnClickListener(this);
        lay_iam.setOnClickListener(this);
        lay_good.setOnClickListener(this);
        showBanner();
    }
    //设置Banner
        private void showBanner() {
            //设置横幅风格
        findBanner.setBannerStyle(Banner.CIRCLE_INDICATOR);
            //设置小圆点
        findBanner.setIndicatorGravity(Banner.CENTER);
            //设置延迟的时间  几秒动一下
        findBanner.setDelayTime(2000);

        findBanner.setImages(findBannerUrls);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.find_search://搜索页面
                Intent intent = new Intent(context, SearchActivity.class);
                context.startActivity(intent);
                break;
            case R.id.llay_good://我是专业投资人
                  Intent intentGood=new Intent(getContext(), GoodActivity.class);
                getContext().startActivity(intentGood);
                break;
            case R.id.llay_iam://我是创业者
                 Intent intentIam=new Intent(context, IAmActivity.class);
                 context.startActivity(intentIam);
                break;
            case R.id.Btn_academy://36氪研究院
                 Intent intentAcademy= new Intent(context, AcademyActivity.class);
                 context.startActivity(intentAcademy);
                break;
            case R.id.Btn_event://近期活动
                 Intent intent1= new Intent(context, EventActivity.class);
                context.startActivity(intent1);
                break;
            case R.id.fram_iaminvester://寻找投资人
                 Intent people= new Intent(context, PeopleActivity.class);
                context.startActivity(people);
                break;

        }
    }
}


